package com.hkd.product_service.api.fallback;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hkd.common.api.ApiResponse;
import com.hkd.common.api.BaseFallBack;
import com.hkd.common.api.BaseFallbackFactory;
import com.hkd.product_service.api.BrandInfoService;
import com.hkd.product_service.api.dto.BrandListQueryDTO;
import com.hkd.product_service.api.dto.InsertBrandDTO;
import com.hkd.product_service.api.vo.BrandListVO;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author HKD
 * @date 2022/9/17 21:20
 */
@Component
public class BrandInfoServiceImplFallback extends BaseFallbackFactory<BrandInfoService> {
    @Override
    public BrandInfoService create(Throwable throwable) {
        FeignFallback fallback = new FeignFallback();
        fallback.setCause(throwable);
        return fallback;
    }

    public class FeignFallback extends BaseFallBack implements BrandInfoService {

        @Override
        public ApiResponse insertBrandDTO(String curUserId, InsertBrandDTO param) {
            return defaultFallBack();
        }

        @Override
        public ApiResponse<Page<BrandListVO>> listBrand(BrandListQueryDTO param) {
            return defaultFallBack();
        }
    }
}
